<html>
<head>
    <link href="../css/content.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.js"></script>
    <script src="https://cdn.bootcss.com/font-awesome/5.10.0-12/js/all.min.js"></script>
    <script type="text/javascript" src="../js/jquery.qrcode.min.js"></script>
    <script type="text/javascript" src="../js/child_function.js"></script>
</head>
<body>
<?php
include '../class/person.php';
include '../db/sql.php';
$id = $_COOKIE['user_id'];
$from = $db->query("SELECT * from Base_User where Account = '$id'");
$row = $from->fetch();
$SqlToPerson[0] = strval($row['EnCode']);
$SqlToPerson[1] = strval($row["Account"]);
$SqlToPerson[2] = strval($row["Password"]);
$SqlToPerson[3] = strval($row["RealName"]);
$SqlToPerson[4] = strval($row["Gender"]);
$SqlToPerson[5] = strval($row["Birthday"]);
$SqlToPerson[6] = strval($row["Mobile"]);
$SqlToPerson[7] = strval($row["Telephone"]);
$SqlToPerson[8] = strval($row["Email"]);
$SqlToPerson[9] = strval($row["OrganizeId"]);
$SqlToPerson[10] = strval($row["DepartmentId"]);
$SqlToPerson[11] = strval($row["RoleId"]);
$SqlToPerson[12] = strval($row["DutyId"]);
$SqlToPerson[13] = strval($row["PreviousVisit"]);
$SqlToPerson[14] = strval($row["LastVisit"]);
$SqlToPerson[15] = strval($row["LogOnCount"]);
$SqlToPerson[16] = strval($row["DeleteMark"]);
$SqlToPerson[17] = strval($row["EnableMark"]);
$SqlToPerson[18] = strval($row["CreatDate"]);
$SqlToPerson[19] = strval($row["CreatUserId"]);
$SqlToPerson[20] = strval($row["ModifyDate"]);
$SqlToPerson[21] = strval($row["ModifyUserId"]);
$im = new person_info\person($SqlToPerson, $db);
?>
<div id="person_info_border">
    <div id="info_list">
        <ul>
            <li><a href="#base_info">基本信息</a></li>
            <li><a href="#connect_info">联系方式</a></li>
            <li><a href="#change_pw">修改密码</a></li>
        </ul>
    </div>
    <div id="info_content">
        <div id="base_info">
            <div class="info_content_title">基本信息</div>
            <div class="info_content_content">
                <table>
                    <tr>
                        <td class="tr_name">账户</td>
                        <td class="tr_content"><input readonly="readonly"
                                                      value="<?php echo $im->person_array['EnCode'] ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">工号</td>
                        <td class="tr_content"><input readonly="readonly"
                                                      value="<?php echo $im->person_array['Account'] ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">姓名</td>
                        <td class="tr_content"><input readonly="readonly"
                                                      value="<?php echo $im->person_array['RealName'] ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">生日</td>
                        <td class="tr_content"><input readonly="readonly"
                                                      value="<?php echo $im->person_array['Birthday'] ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">性别</td>
                        <td class="tr_content"><input readonly="readonly" value="<?php
                            if ($im->person_array['Gender'] == 1) {
                                echo "男";
                            } else {
                                echo "女";
                            } ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">部门</td>
                        <td class="tr_content"><input readonly="readonly" value="<?php
                        $dept_id = $im->person_array['DepartmentId'];
                            $from = $db->query("SELECT FullName from Base_Department where DepartmentId = '$dept_id'");
                            $row = $from->fetch();
                            $dept_name = $row['FullName'];
                            echo $dept_name;
                            ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">……</td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="connect_info">
            <div class="info_content_title">联系方式</div>
            <div class="info_content_content">
                <table>
                    <tr>
                        <td class="tr_name">手机</td>
                        <td class="tr_content"><input id="Mobile" value="<?php echo $im->person_array['Mobile'] ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">电话</td>
                        <td class="tr_content"><input id="Telephone" value="<?php echo $im->person_array['Telephone'] ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">邮箱</td>
                        <td class="tr_content"><input id="Email" value="<?php echo $im->person_array['Email'] ?>"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">……</td>
                        <td class="tr_content"><input class="save_button" type="button" onclick="update_connect_info_complete()" value="保存"></td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="change_pw">
            <div class="info_content_title">修改密码</div>
            <div class="info_content_content">
                <table>
                    <tr>
                        <td class="tr_name">旧密码</td>
                        <td class="tr_content"><input type="password" id="old_password"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">新密码</td>
                        <td class="tr_content"><input type="password" id="new_password"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">重复新密码</td>
                        <td class="tr_content"><input type="password" id="new_password_again"></td>
                    </tr>
                    <tr>
                        <td class="tr_name">……</td>
                        <td class="tr_content"><input class="save_button" type="button" onclick="update_password_complete()" value="保存"></td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
</html>